package com.himore.api.web.service.impl;

import java.util.List;

import com.himore.api.common.utils.DateUtils;
import com.himore.api.web.mapper.UserComplaintsMapper;
import com.himore.api.web.model.UserComplaints;
import com.himore.api.web.service.IUserComplaintsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 吐槽信息Service业务层处理
 * 
 * @author dongwang
 * @date 2020-12-29
 */
@Service
public class UserComplaintsServiceImpl implements IUserComplaintsService
{
    @Autowired
    private UserComplaintsMapper userComplaintsMapper;

    /**
     * 查询吐槽信息
     * 
     * @param complaintsId 吐槽信息ID
     * @return 吐槽信息
     */
    @Override
    public UserComplaints selectUserComplaintsById(Long complaintsId){
        return userComplaintsMapper.selectUserComplaintsById(complaintsId);
    }

    /**
     * 查询吐槽信息列表
     * 
     * @param userComplaints 吐槽信息
     * @return 吐槽信息
     */
    @Override
    public List<UserComplaints> selectUserComplaintsList(UserComplaints userComplaints){
        return userComplaintsMapper.selectUserComplaintsList(userComplaints);
    }

    /**
     * 新增吐槽信息
     * 
     * @param userComplaints 吐槽信息
     * @return 结果
     */
    @Override
    public int insertUserComplaints(UserComplaints userComplaints){
        userComplaints.setCreateTime(DateUtils.getNowDate());
        return userComplaintsMapper.insertUserComplaints(userComplaints);
    }

    /**
     * 修改吐槽信息
     * 
     * @param userComplaints 吐槽信息
     * @return 结果
     */
    @Override
    public int updateUserComplaints(UserComplaints userComplaints){
        userComplaints.setUpdateTime(DateUtils.getNowDate());
        return userComplaintsMapper.updateUserComplaints(userComplaints);
    }

    /**
     * 批量删除吐槽信息
     * 
     * @param complaintsIds 需要删除的吐槽信息ID
     * @return 结果
     */
    @Override
    public int deleteUserComplaintsByIds(Long[] complaintsIds){
        return userComplaintsMapper.deleteUserComplaintsByIds(complaintsIds);
    }

    /**
     * 删除吐槽信息信息
     * 
     * @param complaintsId 吐槽信息ID
     * @return 结果
     */
    @Override
    public int deleteUserComplaintsById(Long complaintsId){
        return userComplaintsMapper.deleteUserComplaintsById(complaintsId);
    }
}
